00001
00002
00003
00004 #include "stdafx.h"
00005 #include "TraffEdu.h"
00006 #include "MainFrm.h"
00007
00008 #include "TraffEduDoc.h"
00009 #include "TraffEduView.h"
00010
00011 #ifdef _DEBUG
00012 #define new DEBUG_NEW
00013 #endif
00014
00015
00016
00017
00018 BEGIN_MESSAGE_MAP(CTraffEduApp, CWinApp)
00019 ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
00020
00021 ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
00022 ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
00023
00024 ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
00025
00026
00027
00028 END_MESSAGE_MAP()
00029
00030
00031
00032
00033 CTraffEduApp::CTraffEduApp()
00034 {
00035 }
00036
00037
00038
00039
00040 CTraffEduApp theApp;
00041
00042
00043
00044 BOOL CTraffEduApp::InitInstance()
00045 {
00046
00047
00048
00049 InitCommonControls();
00050
00051 CWinApp::InitInstance();
00052
00053
00054 if (!AfxOleInit())
00055 {
00056 AfxMessageBox(IDP_OLE_INIT_FAILED);
00057 return FALSE;
00058 }
00059 AfxEnableControlContainer();
00060 SetRegistryKey(_T("Local AppWizard-Generated Applications"));
00061 LoadStdProfileSettings(4);
00062 CSingleDocTemplate* pDocTemplate;
00063 pDocTemplate = new CSingleDocTemplate(
00064 IDR_MAINFRAME,
00065 RUNTIME_CLASS(CTraffEduDoc),
00066 RUNTIME_CLASS(CMainFrame),
00067 RUNTIME_CLASS(CTraffEduView));
00068 if (!pDocTemplate)
00069 return FALSE;
00070 AddDocTemplate(pDocTemplate);
00071
00072 CCommandLineInfo cmdInfo;
00073 ParseCommandLine(cmdInfo);
00074
00075
00076 if (!ProcessShellCommand(cmdInfo))
00077 return FALSE;
00078
00079 m_pMainWnd->ShowWindow(SW_SHOW);
00080 m_pMainWnd->UpdateWindow();
00081
00082
00083 return TRUE;
00084 }
00085
00086
00087
00088
00089
00090 class CAboutDlg : public CDialog
00091 {
00092 public:
00093 CAboutDlg();
00094
00095
00096 enum { IDD = IDD_ABOUTBOX };
00097
00098 protected:
00099 virtual void DoDataExchange(CDataExchange* pDX);
00100
00101
00102 protected:
00103 DECLARE_MESSAGE_MAP()
00104 public:
00105 afx_msg void OnContextMenu(CWnd* , CPoint );
00106 };
00107
00108 CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
00109 {
00110 }
00111
00112 void CAboutDlg::DoDataExchange(CDataExchange* pDX)
00113 {
00114 CDialog::DoDataExchange(pDX);
00115 }
00116
00117 BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
00118 ON_WM_CONTEXTMENU()
00119 END_MESSAGE_MAP()
00120
00121
00122 void CTraffEduApp::OnAppAbout()
00123 {
00124 CAboutDlg aboutDlg;
00125 aboutDlg.DoModal();
00126 }
00127
00128 BOOL CTraffEduApp::OnIdle(LONG lCount)
00129 {
00130 BOOL continue_processing = CWinApp::OnIdle(lCount);
00131 CMainFrame* pFrame = dynamic_cast<CMainFrame*> (m_pMainWnd);
00132 if (pFrame)
00133 {
00134 if ( pFrame->DoChildIdleProc() )
00135 return TRUE;
00136 }
00137 return continue_processing;
00138 }
00139
00140
00141
00142
00143
00144 void CAboutDlg::OnContextMenu(CWnd* pWnd, CPoint point)
00145 {
00146
00147 }